<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
  <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
  <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
  <style type="text/css">
    #tooltip{
      position:absolute;
      border:1px solid #ccc;
      background:#333;
      padding:2px;
      display:none;
      color:#fff;
    }
  </style>
</head>
<body style="padding:10px;">
  <div class="tplay-body-div">
    <div class="layui-tab">
      <ul class="layui-tab-title">
        <li class="layui-this">幻灯管理</li>
        <li><a href="{:url('admin/show/publish')}" class="a_menu">幻灯新增</a></li>
      </ul>
    </div> 
    <table class="layui-table" lay-size="sm">
      <colgroup>
        <col width="50">
        <col width="50">
        <col width="150">
        <col>
        <col width="100">
        <col width="100">
        <col width="180">
      </colgroup>
      <thead>
        <tr>
          <th>ID</th>
          <th>预览</th>
          <th>所属项</th>
          <th>幻灯名称</th>
          <th>简短描述</th>
          <th>排序</th>
          <th>操作</th>
        </tr> 
      </thead>
      <tbody>
          {volist name="show" id="vo"}
          <tr>
            <td >{$vo.id}</td>
            <td>
              {if condition="$vo.thumb neq 0"}
                <a href="{$vo.thumb|geturl}" class="tooltip">
                  <img src="{$vo.thumb|geturl}" width="20" height="20">
                </a>
              {else/}
                <img src="/public/static/admin/images/404.png" width="20" height="20">
              {/if}
            </td>
            <td >{$vo.nav_id|get_nav_name}</td>
            <td >{$vo.title}</td>
            <td >{$vo.description}</td>
            <td >{$vo.sort}</td>
            <td >
              <a href="{:url('admin/show/publish',['id'=>$vo.id])}" class="layui-btn layui-btn-xs layui-btn-normal">编辑</a>
              <button class="layui-btn layui-btn-xs layui-btn-danger delete" id="{$vo.id}">
                删除
              </button>
            </td>
          </tr>
          {/volist}
      </tbody>
    </table>
    <div style="padding:0 20px;"></div>
            
    {include file="public/foot"}
    <script type="text/javascript">

    $('.delete').click(function(){
      var id = $(this).attr('id');
      layer.confirm('确定要删除?', function(index) {
        $.ajax({
          url:"{:url('admin/attachment/delete')}",
          data:{id:id},
          success:function(res) {
            layer.msg(res.msg);
            if(res.code == 1) {
              setTimeout(function(){
                location.href = res.url;
              },1500)
            }
          }
        })
      })
    })

    </script>

  </div>
</body>
</html>
